import React, { useImperativeHandle } from 'react'

function Test2(props, ref) {
  useImperativeHandle(ref, () => ({
    printA: () => {
      console.log('printA')
    },
    testObj:{
      name: '张三',
      age: 18
    }
  }));
  return (
    <h3 {...props} ref={ref}>ref的使用</h3>
  )
}
export default React.forwardRef(Test2)